<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<form id="pagerForm" method="get" model="viewRequest" action="#rel#">
	<input type="hidden" name="viewRequest.page" value="${page.number}" />
	<input type="hidden" name="viewRequest.size" value="${page.size}" />
	<c:forEach items="${viewRequest.params}" var="params">
		<input type="hidden" id="${params.key}" name="viewRequest.params['${params.key}']" value="${params.value}" />
	</c:forEach>
	<c:forEach items="${viewRequest.sort}" var="sort">
		<input type="hidden" name="viewRequest.sort.${sort.key}" value="${sort.value}" />
	</c:forEach>
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return orders_navSearch(this);" action="${rootUrl}/order/orders/0/search?memberId=${memberId}" method="get">
	<div class="searchBar">
		<ul class="searchContent" style="height: 60px">
			<li>
				<label>订单编号：</label>
				<input type="text" name="viewRequest.params['o_dot_code_like']" value="${viewRequest.params.o_dot_code_like}"/>
			</li>
			<li style="width: 500px">
				<label>下单时间：</label>
				<input name="viewRequest.params['_and_o_dot_createdAt_ge_date']" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" size="20" value="${viewRequest.params['_and_o_dot_createdAt_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_o_dot_createdAt_le_date']" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" size="20" value="${viewRequest.params['_and_o_dot_createdAt_le_date'] }" placeholder="结束时间"/>
			</li>
			<li style="width: 500px">
				<label>支付时间：</label>
				<input name="viewRequest.params['_and_o_dot_payTime_ge_date']" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" size="20" value="${viewRequest.params['_and_o_dot_payTime_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_o_dot_payTime_le_date']" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" size="20" value="${viewRequest.params['_and_o_dot_payTime_le_date'] }" placeholder="结束时间"/>
			</li>
			<li>
				<label>下单用户：</label>
				<input type="text" style="float:left" value="${member.name}" readonly="readonly"/>
			</li>
			<li>
				<label>支付单号：</label>
				<input type="text" name="viewRequest.params['_and_o_dot_payCode_like']" value="${viewRequest.params._and_o_dot_payCode_like}"/>
			</li>
			<li>
				<label>订单状态：</label>
				<select name="viewRequest.params['_and_g_dot_state_eq_string']">
					<option value="" <c:if test="${viewRequest.params._and_g_dot_state_eq_string == ''}">selected="selected"</c:if>>全部</option>
					<c:forEach var="item" items="${orderState}">   
						<option value="${item.key}" <c:if test="${viewRequest.params._and_g_dot_state_eq_string == item.key}">selected="selected"</c:if>>${item.value}</option>
					</c:forEach>
				</select>
			</li>
			<li>
				<label>支付方式：</label>
				<select name="viewRequest.params['_and_o_dot_payChannel_eq_string']">
						<option value="" <c:if test="${viewRequest.params._and_o_dot_payChannel_eq_string == ''}">selected="selected"</c:if>>全部</option>
					<c:forEach var="item" items="${payChannel}">   
						<option value="${item.key}" <c:if test="${viewRequest.params._and_o_dot_payChannel_eq_string == item.key}">selected="selected"</c:if>>${item.value}</option>
					</c:forEach>
				</select>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<table class="table" targetType="dialog"  width="100%" layoutH="170">
		<thead>
			<tr>
				<th width="30" align="center" >序号</th>
				<th width="100">订单编号</th>
				<th width="100">买家</th>
				<th width="150">支付单号</th>
				<th width="70">支付渠道</th>
				<th width="120">支付时间</th>
				<th width="120">下单时间</th>
				<th width="50">商品金额</th>
				<th width="50">优惠金额</th>
				<th width="50">订单金额</th>
				<th width="50">运费金额</th>
				<th width="50">应付金额</th>
				<th width="50">退款金额</th>
				<th width="100">订单状态</th>
				<th width="100">完成时间</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.content}" var="orders" varStatus="status">
				<td>${status.count}</td>
				<td>${orders.code}</td>
				<td>${orders.member.loginname}</td>
				<td>${orders.payCode}</td>
				<td>${payChannel[orders.payChannel]}</td>
				<td><fmt:formatDate value="${orders.payTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><fmt:formatDate value="${orders.createdAt}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders.goodsAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders.discountAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders.orderAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders.freightAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders.resultAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders.refundAmount/100}" pattern="0.00"/></td>
				<td>${orderState[orders.state]}</td>
				<td><fmt:formatDate value="${orders.finishTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="${page.size}">${page.size}</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共${page.totalElements}条 </span>
		</div>
		<div class="pagination" targetType="dialog" totalCount="${page.totalElements}" numPerPage="${page.size}" pageNumShown="10" currentPage="${page.number}"></div>
	</div>
</div>
<script>
	function orders_navSearch(obj){
		$("#memberId").attr("name","viewRequest.params['_and_o_dot_member_dot_id_eq_number']");
		$("#memberName").attr("name","memberName");
		
		return dialogSearch(obj);
	}
</script>